package com.sgb.kjwl.view.ui.adapter.pick;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;

import com.sgb.kjwl.BR;
import com.sgb.kjwl.R;
import com.sgb.kjwl.model.entity.PickClEntity;
import com.swgk.core.recyclerview.adapter.BaseRecycleAdapter;
import com.swgk.core.recyclerview.adapter.ItemViewHolder;
import com.swgk.core.util.MLog;

import java.util.List;

public class PickClAdapter extends BaseRecycleAdapter<PickClEntity> {
    public PickClAdapter(Context context, List<PickClEntity> datas) {
        super(context, R.layout.item_pick_cl, datas);
    }

    @Override
    public void convert(ItemViewHolder holder, PickClEntity data) {
        holder.setBinding(BR.viewModel, data);

        holder.itemView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                ImageView img = holder.itemView.findViewById(R.id.iv_arrow);
                if (holder.itemView.findViewById(R.id.ll_detail).getVisibility() == View.GONE) {
                    holder.itemView.findViewById(R.id.ll_detail).setVisibility(View.VISIBLE);
                    img.setImageResource(R.drawable.up);
                } else {
                    holder.itemView.findViewById(R.id.ll_detail).setVisibility(View.GONE);
                    img.setImageResource(R.drawable.down);
                }
            }
        });
    }
}
